Repository navigation
fix(mcp): load every page of tools/list - #81
Open
pcbeingused33 wants to merge 1 commit into
Open
pcbeingused33 wants to merge 1 commit into
pcbeingused33 wants to merge 1 commit into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Contributor
|
Thanks, this is a good catch, and the tests cover all three transports. Since it changes how every MCP server's tools get loaded, I'd like to review it myself and get CI green before merging. The one failure on Python 3.13 ( Generated by Claude Code |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
MCPClientnow followsnextCursorwhen listing a server's tools, on all three transports (stdio, SSE, Streamable HTTP).Why
tools/listis paginated in the MCP spec.connect_stdio,connect_sseandconnect_streamable_httpeach calledsession.list_tools()once and built adapters from that first answer, so with a server that pages its list, every tool after page one was missing from the agent, with no error or log line.The three call sites now share
_list_all_tools(), which requests pages until the cursor is absent (an empty string is still a cursor). A server that hands back a cursor already used ends the listing with a warning, and tools are keyed by name so a repeated page does not fail registration. The listing stays inside the existingtry, so a failure on a later page is cleaned up like one on the first.Type
Tests
tests/test_mcp_tool_pagination.pycovers a three-page listing on each transport and the repeated-cursor case; all four fail without the change. Also checked against a stdio server built with the SDK that serves one tool per page: a single call returnedt0, the new helper returnst0,t1,t2.Added one line under
[Unreleased] / Fixedindocs/changelog.mdx.Checklist
uv run ruff check src/ tests/passes (the changed files pass; the repo-wide run reports existing errors in other files)uv run pytestpasses (the MCP tests pass; the full suite was not run to completion)cd frontend && pnpm buildpasses (no frontend changes)en/andzh/(no UI text changed)This change was prepared with the help of an AI coding assistant.